]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
systemActions: Don't log error when cancelled
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 21 Oct 2025 22:57:26 +0000 (00:57 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 24 Nov 2025 13:42:59 +0000 (14:42 +0100)
If the logout/reboot/shutdown actions are available, we expect them
to succeed. Unfortunately that changed in the light of systemd
inhibitors (that we don't know about in the shell, and that prevent
those actions now).

While it would be good to fix the underlying issue, we can at least
improve the error reporting in that case and not log the error when
the operation was cancelled: We don't know the underlying reason,
unlike gnome-session which should have logged a more helpful message.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8749
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3927>
(cherry picked from commit d3f3f4e80d338133a2083dd5c267ed456b86303d)

js/misc/systemActions.js

index c24d254b4c6cab3ada7bb2c97b3cbfa6d183f826..d0a934d23644dec3367cdfd16f82d853a18b3189 100644 (file)
@@ -5,6 +5,7 @@ import Gio from 'gi://Gio';
 import GLib from 'gi://GLib';
 import GObject from 'gi://GObject';
 
+import {logErrorUnlessCancelled} from './errorUtils.js';
 import * as GnomeSession from './gnomeSession.js';
 import * as LoginManager from './loginManager.js';
 import * as Main from '../ui/main.js';
@@ -448,21 +449,21 @@ const SystemActions = GObject.registerClass({
             throw new Error('The logout action is not available!');
 
         Main.overview.hide();
-        this._session.LogoutAsync(0).catch(logError);
+        this._session.LogoutAsync(0).catch(logErrorUnlessCancelled);
     }
 
     activatePowerOff() {
         if (!this._actions.get(POWER_OFF_ACTION_ID).available)
             throw new Error('The power-off action is not available!');
 
-        this._session.ShutdownAsync(0).catch(logError);
+        this._session.ShutdownAsync(0).catch(logErrorUnlessCancelled);
     }
 
     activateRestart() {
         if (!this._actions.get(RESTART_ACTION_ID).available)
             throw new Error('The restart action is not available!');
 
-        this._session.RebootAsync().catch(logError);
+        this._session.RebootAsync().catch(logErrorUnlessCancelled);
     }
 
     activateSuspend() {